package jisuanqi;


import java.util.Scanner;


public class jisuanqi {
    public static void main(String[] args) {
        Caculator k = new Caculator();
        Scanner shuru = new Scanner(System.in);
        for (int i = 0; i < 100; i++) {
            String n = shuru.next();
            boolean result = n.matches("[0-9]+");
            if (result == true) {
                if (i == 0) {
                    int x = Integer.parseInt(n);
                    k.setx(x);
                }else{
                    int y = Integer.parseInt(n);
                    k.sety(y);
                }
            }
            if (result == false){
                if (n.equals("=")) {
                    k.calculate();
                }else if(n.equals("q") || n.equals("Q")){
                    System.out.println("结束此次运算");
                    break;
                }else{
                    String mack = n;
                    k.oper(mack);
                }
            }
        }
    }

}

class Caculator {
    private int x;
    private int y;
    private String mark;

    public void setx(int x) {
        this.x = x;
    }

    public void sety(int y) {
        this.y = y;
    }

    public void oper(String m) {
        if (m.equals("+") || m.equals("-") || m.equals("*") || m.equals("/")) {
            mark = m;
        }else if (m.length() == 0){
            mark = "e";
        }else {
            mark = "?";
        }
    }

    public void calculate() {
        switch (mark) {
            case "+":
                x = (x+y);
                System.out.println("计算结果为 ：" + x);
                break;
            case "-":
                x = (x-y);
                System.out.println("计算结果为 ： " + x);
                break;
            case "*":
                x = (x*y);
                System.out.println("计算结果为 ： " + x);
                break;
            case "/":
                x = (x/y);
                System.out.println("计算结果为 ： " + x);
                break;
            case "e":
                System.out.println("输入不能为空，请输入数据！");
                break;
            case "?":
                System.out.println("输入不正确" );
                break;
        }
    }
}